{template 'header', 'member'}
<!--main-block start-->
<div class="main-block bd-gray mt10">
<div class="hd fn-clear">
	<h2 class="fn-left">发布{$MOD[name]}</h2>
</div>
<ul id="data-nav" class="main-nav mt10 fn-clear">
	<li id="status_"><a href="{url('member/my')}?mid={$mid}&action=add{$suffix}">添加信息</a></li>
	<li id="status_3"><a href="{url('member/my')}?mid={$mid}&status=3{$suffix}">已发布({$nums[3]})</a></li>
	<li id="status_2"><a href="{url('member/my')}?mid={$mid}&status=2{$suffix}">审核中({$nums[2]})</a></li>
	<li id="status_1"><a href="{url('member/my')}?mid={$mid}&status=1{$suffix}">未通过({$nums[1]})</a></li>
</ul>
{if $action=='add' || $action=='edit'}
<form id="pub-form" name="pub-form" method="post" action="{url('member/my')}">
	<input type="hidden" name="action" value="{$action}"/>
	<input type="hidden" name="mid" value="{$mid}"/>
	<input type="hidden" name="com" value="{$com}"/>
	<input type="hidden" name="itemid" value="{$itemid}"/>
	<input type="hidden" name="forward" value="{$forward}"/>
	<table class="data-form">
		{if $status==1 && $action=='edit' && $note}
		<tr>
			<th width="90">未通过原因</th>
			<td width="640">{$note}</td>
		</tr>
		{/if}
		<tr>
			<th width="90"><span class="cred">*</span> 所属分类</th>
			<td width="640">{Post::catTree('post[catid]', $moduleid, '选择分类' ,$catid, 'class="easyui-validatebox" data-options="required:true,missingMessage:\'请选择分类\'"')} <span id="dcatid" class="cred"></span></td>
		</tr>
		<tr>
			<th width="90">标题</th>
			<td width="640"><input name="post[title]" type="text" id="title" size="50" class="graybd-ipt easyui-validatebox" data-options="required:true,validType:'length[3,50]',invalidMessage:'长度在3-50内',missingMessage:'请输入标题'" value="{$title}"/> （2-30个字）<span id="dtitle" class="cred"></span></td>
		</tr>
		<tr id="carcatTr">
			<th width="90">适用车型</th>
			<td width="640">
				{Post::autoCombo('post[arbid][]','post[arcid][]', 'post[amid][]', $item['arbid'],$item['arcid'],$item['amid'], 0, 0, 0)}
			</td>
		</tr>
		<tr>
			<th width="90">标题图片</th>
			<td width="640">{Post::picture($moduleid, 'thumb', 'post[thumb]', $thumb ,$MOD['thumb_width'], $MOD['thumb_height'])}</td>
		</tr>
		<tr>
			<th width="90"><span class="cred">*</span> 资讯内容</th>
			<td width="640">
				{Post::kindEditor('post[content]', $moduleid, $content,'','675px','280px')}
			</td>
		</tr>
		<tr>
			<th width="90">资讯作者</th>
			<td width="640"><input name="post[author]" type="text" class="easyui-validatebox graybd-ipt" value="{$author}" /> </td>
		</tr>
		{if $action=='add'}
		<tr>
			<th><span class="cred">*</span>发布区域</th>
			<td class="tr">
				<input id="J_AreaNames" class="J_MultiIpt fn-left" type="text" size="30" value="{$AREA[$userinfo['cityid']]['areaname']}">
				<input id="J_CityIds" type="hidden" value="{$userinfo['cityid']}" name="post[city]" >
				<input id="J_AreaIds" type="hidden" value="{$userinfo['cityid']}">
				<button id="J_SelectArea" type="button" class="J_MultiSubmit fn-left">选择</button>
			</td>
		</tr>
		<tr>
			<th>发布费用</th>
			<td class="tr">
				所发城市数量<input type="text" size="5" disabled="disabled" id="citylen" style="text-align: center">
				&nbsp;共计发布费用 <input type="text" size="6" disabled="disabled" id="cityprice"
				                    style="text-align: center;color:#f00;font-size: 14px"> 元
				<span class="c666">（每城市发布单价{$MG[$module.'_charge']}元/信息）</span>
			</td>
		</tr>
		{/if}
		{if $action=='edit'}
		<tr>
			<th width="90">发布区域</th>
			<td width="640">
				{loop $city $t}
				{if $t==0}
				<span class="c666">全国&nbsp;</span>
				{else}
				<span class="c666">{$AREA[$t][areaname]}&nbsp;</span>
				{/if}
				{/loop}
			</td>
		</tr>
		{/if}
		{if $need_captcha}
		<tr>
			<th><span class="cred">*</span> 验证码</th>
			<td>{template 'captcha', 'chip'} <span id="dcaptcha" class="cred"></span></td>
		</tr>
		{/if}
		<tr>
			<th>&nbsp;</th>
			<td class="sub-info">
				<button type="submit" class="btn">提 交</button>
				<input type="button" value=" 返 回 " class="btn" onclick="history.back(-1);"/>
			</td>
		</tr>
	</table>
</form>
	<div id="J_PatDialog" class="pay-dialog fn-hide">
		<div class="dialog-bar"><a class="J_CloseDialog" href="javascript:void(0)" title="关闭">关闭</a></div>
		<p class="pay-tip" style="height: 110px"><i class="warn"></i><span></span></p>
		<p>请根据您的情况点击下面按钮：</p>
		<div class="buy-btns fn-clear">
			<a class="pay-btn" href="{SITE_URL}member/charge.php?action=pay&status=3" target="_blank">去充值</a>
			<a class="J_CloseDialog pay-btn" style="cursor: pointer" id="sub">已完成充值</a>
		</div>
	</div>
<script type="text/javascript">
	seajs.use(['$', 'easyui','easyui-css'], function ($) {
		$('#pub-form').form({
			success: function(data){
				var data = eval('(' + data + ')');
				if (!data.success){
					$('#sub').click(function(){ $('#pub-form').submit();} );
					$("#J_PatDialog").show();
					$(".pay-tip").find('span').html('发布此条信息所需金额<strong style="color: #f00">'+data.total+'</strong>元,您的余额不足，请充值后再发布！');
					return false;
				}
			}
		});
	});
</script>
{else}
<div class="filter con fn-clear">
	<form id="buy-filter-form" name="buy-filter-form" action="{url('member/my')}" method="post">
		<input type="hidden" name="mid" value="{$mid}"/>
		<input type="hidden" name="status" value="{$status}"/>
		{Post::catTree('catid', $moduleid, '不限分类', $catid, 'class="fn-left mr10"')}
		<input class="fn-left mr10" type="text" name="kw" value="{$kw}" title="关键词" size="60"/>
		<button class="btn fn-left mr20" type="submit">搜索</button>
		<button class="btn fn-left" type="reset" onclick="window.location='{url('member/my')}?mid={$mid}&status={$status}';">重置</button>
	</form>
</div>
<form method="post" action="{url('member/my')}">
	<table class="filter-tb mt10 c000 con">
		<thead>
		<tr class="c666">
			<th width="300"><input id="sel-all" class="nobd fn-left mr10" type="checkbox"><label class="fn-left" for="sel-all">标 题</label></th>
			<th width="150">分 类</th>
			<th width="120">{if $timetype=='add'}添加{else}更新{/if}时间</th>
			<th width="60">浏览</th>
			<th width="120">管理</th>
		</tr>
		</thead>
		<tbody id="pub-list">
		{loop $lists $k $v}
		<tr>
			<td>
				<input type="checkbox" name="itemid[]" class="nobd fn-left mr10" value="{$v[itemid]}"/>
				{if $v[status]==3}
				<a class="fn-left" href="{url($module.'/show', 'itemid='.$v['itemid'])}" target="_blank">{$v[title]}</a>
				{else}
				<a class="fn-left" href="{url('member/my')}?mid={$mid}&action=edit&itemid={$v[itemid]}">{$v[title]}</a>
				{/if}
			</td>
			<td>&nbsp;&nbsp;<a href="{url($module.'/list', 'catid='.$v['catid'])}" target="_blank">{$v[catname]}</a>&nbsp;&nbsp;</td>
			{if $timetype=='add'}
			<td class="c666" title="更新时间 {$v[editdate]}">{$v[adddate]}</td>
			{else}
			<td class="c666" title="添加时间 {$v[adddate]}">{$v[editdate]}</td>
			{/if}
			<td class="c666">{$v[hits]}</td>
			<td class="pub-oper">
				<a class="edit-link" href="{url('member/my')}?mid={$mid}&action=edit&itemid={$v[itemid]}{$suffix}" title="编辑">编辑</a>
				{if $MG[copy]}
				<a class="copy" href="{url('member/my')}?mid={$mid}&action=add&itemid={$v[itemid]}&catid={$v[catid]}" title="复制">复制</a>
				{/if}
				{if $MG[delete]}
				<a class="del" href="{url('member/my')}?mid={$mid}&action=delete&itemid={$v[itemid]}" onclick="return confirm('确定要删除吗？此操作将不可撤销');" title="删除">删除</a>
				{/if}
			</td>
		</tr>
		{/loop}
		</tbody>
	</table>
	{if $MG[delete] || $timetype!='add'}
	<div class="con fn-clear">
		{if $MG[delete]}
		<button onclick="if( confirm('确定要删除选中{$MOD[name]}吗？')){this.form.action='?mid={$mid}&status={$status}&action=delete'}else{return false;}" class="btn fn-right">删除选中</button>
		{/if}
		{if $timetype!='add'}
		<button onclick="this.form.action='?mid={$mid}&status={$status}&action=refresh';" class="btn fn-left">刷新选中</button>
		{if $MOD[credit_refresh]}
		刷新一条信息一次需消费 <strong class="cred">{$MOD[credit_refresh]}</strong> 积分，当积分不足时将不可刷新
		{/if}
		{/if}
	</div>
	{/if}
</form>
{if $MG[info_limit] || (!$MG['fee_mode'] && $MOD[fee_add])}
<div class="con">
	{if $MG[info_limit]}
	总共可发 <span class="f_b cred">{$MG[info_limit]}</span> 条&nbsp;&nbsp;&nbsp;
	当前已发 <span class="f_b">{$limit_used}</span> 条&nbsp;&nbsp;&nbsp;
	还可以发 <span class="f_b f_blue">{$limit_free}</span> 条&nbsp;&nbsp;&nbsp;
	{/if}
</div>
{/if}
<div class="pages con fn-clear">
	<span class="sum fn-right">共{php echo $do->getPn()->getPages()}页</span>
	<ul class="fn-right fn-clear">
		{php $do->getPn()->render()}
	</ul>
</div>
{/if}
</div>
<script type="text/javascript">
	seajs.use(['member'], function(member){
		member.active('menu_info{$com}', 'mid_26', 'status_{$status}')
		<!--{if $action=='add'}-->
		$('#J_CityIds').change(function(){
			member.charge({$moduleid},{$_groupid},"{$_username}",$(this).val());
		});
		member.charge({$moduleid},{$_groupid},"{$_username}",$("#J_CityIds").val());
		<!--{/if}-->
	})
</script>
{template 'footer', 'member'}
